<template>
  <div
    @click="handle"
    class="itButton"
    :class="{ success: type == 'success', error: type == 'error' }"
  >
    <!-- 插槽 -->
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    type: {
      type: String,
    },
    // 按钮开关：
    // btn_flag: {
    //   type: Boolean,
    // },
  },
  // 方法：
  methods: {
    handle(e) {
      this.$emit("click", { e });
    },
  },
};
</script>

<style lang="less" scoped>
.itButton {
  margin: 50px auto 0;
  width: 300 * 100vw / 360;
  height: 50px;
  line-height: 50px;
  background-color: #ccc;
  text-align: center;
  border-radius: 30px;
  font-size: 22px;
  color: #888;
}
.success {
  background-color: rgb(47, 189, 255);
  color: white;
}
.error {
  background-color: red;
  color: white;
}
</style>